#pragma once
#include <memory>
#include <string>
#include "zuc/nml_intf/zucpos.h"

namespace funcio {
enum class FuncInType : uint8_t
{
    RobPowerOn,            //本体上电
    RobPowerOff,           //本体断电
    RobEnable,             //本体使能
    RobDisable,            //本体去使能
    RobBackInitialPos,     //回初始点
    RobDragOn,             //开启拖动模式
    RobDragOff,            //关闭拖动模式
    RobPercentageModeLv1,  //进入一级倍率模式
    RobPercentageModeLv2,  //进入二级倍率模式
    RobStopMode,           //进入停止模式
    ErrorReset,            //错误复位
    TaskRun,
    TaskStop,
    TaskPause,
    TaskResume,
};

enum class FuncStat
{
    Active,  //功能被激活
    Inactive,
};
enum class CheckCond
{
    Rising,
    Falling,
    High,
    Low,
};

class FuncInItf
{
public:
    virtual ~FuncInItf() {}
    virtual std::string get_name() = 0;
    virtual int set_check_cond(CheckCond cond) { return -1; }
    inline CheckCond get_check_cond() const { return check_cond_; }
    virtual FuncStat stat() = 0;

protected:
    CheckCond check_cond_;
};
int init_funcio();
void check_safety_io();
void check_func_io();
std::shared_ptr<FuncInItf> func_in(FuncInType type);

}  // namespace funcio
